#!/usr/bin/env python3

'''
调用gender_prediction接口
'''
from gender import *
from google_image_api import *
import time
import random


class gender_prediction(object):
    def __init__(self,name,org,i):
        self.name = name
        self.org = org
        self.i = i


    def use_gender_prediction(self):
        g = Gender()

        google_image = Google_image(self.name,self.org)
        #self.get_image_url()
        google_image_socre = google_image.final_image_score()
        #print(google_image_socre)

        #print(g.predict(name='Jie Tang', org='Tsinghua University', image_url='http://www.cs.tsinghua.edu.cn/publish/cs/4616/20110330101939787483549/20190321114128398502759.jpg'))
        #返回根据genderprediction结果

        #print(g.predict(name=self.name,org=self.org,image_file=image_file))

        gender_prediction_result = g.predict(name=self.name,org=self.org,image_score=google_image_socre,i = self.i)
        time.sleep(random.randint(5,15))

        return gender_prediction_result
